﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Work01.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
          <%--  1. 姓名：必填，且不能为admin

   密码：必填

   再次输入密码：必须一致

   年龄：0~100

   出生日期：格式正确，范围1900-01-01到2021-07-01

   毕业时间：格式正确，不能早于出生日期

   邮箱：格式正确

   提交

   错误汇总：单段，弹框。

   注册成功！ 超链接：去登陆



登录页面：默认显示用户名

用户名：

密码：

登录按钮   如果成功，跳转到首页，你好+用户名！--%>
            
        <h1>注册页面</h1>
          用户名:  <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="不能为空" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
            <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="不能为admin" OnServerValidate="CustomValidator1_ServerValidate" ControlToValidate="TextBox1"></asp:CustomValidator>
            <br />
            密码:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="不能为空" ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
            <br />
            再次输入密码:<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="不能为空" ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
            <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="两次必须输入一致" ControlToCompare="TextBox2" ControlToValidate="TextBox3"></asp:CompareValidator>
            <br />
            年龄：<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="不能为空" ControlToValidate="TextBox4"></asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="范围要在0-100之间" MaximumValue="100" MinimumValue="0" ControlToValidate="TextBox4" Display="Dynamic" Type="Integer"></asp:RangeValidator>
            <br />
            出生日期:<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="不能为空" ControlToValidate="TextBox5" Display="Dynamic"></asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="毕业日期不能比出生日期小" MaximumValue="2021-07-01" MinimumValue="1900-01-01" Type="Date" ControlToValidate="TextBox5" Display="Dynamic"></asp:RangeValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="格式不正确" ValidationExpression="^\d{4}-\d{2}-\d{2}$" ControlToValidate="TextBox5" Display="Dynamic"></asp:RegularExpressionValidator>
            <br />
            毕业日期:<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="不能为空" ControlToValidate="TextBox6" Display="Dynamic"></asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator3" runat="server" ErrorMessage="超出范围！范围1900-01-01~2021-07-01" ControlToValidate="TextBox6" MaximumValue="2021-07-01" MinimumValue="1900-01-01" Type="Date" Display="Dynamic"></asp:RangeValidator>
            <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="格式不正确 正确格式为1900-01-01" ValidationExpression="^\d{4}-\d{2]-\d{2}$" Display="Dynamic" ControlToValidate="TextBox6"></asp:RegularExpressionValidator>--%>
            <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="不能早于出生日期" ControlToCompare="TextBox5" ControlToValidate="TextBox6" Display="Dynamic" Operator="GreaterThan"></asp:CompareValidator>
            <br />
            邮箱:<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="不能为空" ControlToValidate="TextBox7"></asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="请输入你的邮箱地址" ControlToValidate="TextBox7" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
            <br />
            <asp:Button ID="Button1" runat="server" Text="提交"  OnClick="Button1_Click"/>
            <br />
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
            <br />
            <asp:Label ID="Label1" runat="server" Text=""></asp:Label>

        </div>
    </form>
</body>
</html>
